package com.bilubi.reggie.reggie.mapper;

import com.bilubi.reggie.reggie.annotation.AutoCleanRedis;
import com.bilubi.reggie.reggie.annotation.AutoFill;
import com.bilubi.reggie.reggie.bean.Dish;
import com.bilubi.reggie.reggie.bean.vo.DishVo;
import com.bilubi.reggie.reggie.enums.OperateType;
import com.bilubi.reggie.reggie.enums.RedisDataType;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
@Mapper
public interface DishMapper {
    @AutoCleanRedis(value = RedisDataType.DISH)
    int deleteByPrimaryKey(Long id);

    @AutoCleanRedis(value = RedisDataType.DISH)
    @AutoFill(value = OperateType.INSERT)
    int insert(Dish record);

    @AutoCleanRedis(value = RedisDataType.DISH)
    @AutoFill(value = OperateType.INSERT)
    int insertSelective(DishVo record);

    DishVo selectByPrimaryKey(Long id);

    @AutoCleanRedis(value = RedisDataType.DISH)
    @AutoFill(value = OperateType.UPDATE)
    int updateByPrimaryKeySelective(DishVo record);

    @AutoCleanRedis(value = RedisDataType.DISH)
    int updateByPrimaryKey(Dish record);

    int selectCountByCategoryId(Long categoryId);

    List<Map<String, Object>> selectAllDish(String name);

    @AutoCleanRedis(value = RedisDataType.DISH)
    @AutoFill(value = OperateType.UPDATE)
    int updateStatusById(List<Dish> dishs);

    @AutoCleanRedis(value = RedisDataType.DISH)
    @AutoFill(value = OperateType.UPDATE)
    Integer deleteById(List<Dish> dishs);

    List<DishVo> selectDishByCategoryId(Long categoryId);
}